From: Glenn Morris Date: Sat, 13 Jul 2002 18:51:28 +0000 (+0000) Subject: (timeclock-in): Run the new day section if, after rereading the log file, X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~31704 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=8fecb57312f8a8c023203d6c4ad052d24ea6a88c;p=emacs.git (timeclock-in): Run the new day section if, after rereading the log file, timeclock-last-event is nil, indicating no log file exists yet. Take account of the fact that timeclock-discrepancy will be nil in that case. --- diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el index 21a931297e8..db679b8d55e 100644 --- a/lisp/calendar/timeclock.el +++ b/lisp/calendar/timeclock.el @@ -338,9 +338,11 @@ discover the name of the project." (error "You've already clocked in!") (unless timeclock-last-event (timeclock-reread-log)) - (unless (equal (timeclock-time-to-date - (cadr timeclock-last-event)) - (timeclock-time-to-date (current-time))) + ;; Either no log file, or day has rolled over. + (unless (and timeclock-last-event + (equal (timeclock-time-to-date + (cadr timeclock-last-event)) + (timeclock-time-to-date (current-time)))) (let ((workday (or (and (numberp arg) arg) (and arg 0) (and timeclock-get-workday-function @@ -349,7 +351,7 @@ discover the name of the project." (run-hooks 'timeclock-first-in-hook) ;; settle the discrepancy for the new day (setq timeclock-discrepancy - (- timeclock-discrepancy workday)) + (- (or timeclock-discrepancy 0) workday)) (if (not (= workday timeclock-workday)) (timeclock-log "h" (and (numberp arg) (number-to-string arg))))))